<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="com.hubei.service.UserService" %>
<%@ page import="com.hubei.vo.Users" %>

<%
    UserService userService = UserService.getInstance();
    List<Users> userList = userService.getAllUsers();
%>
<html>
<head>
    <title>用户列表</title>
</head>
<body>
<h2>员工列表</h2>
<table border="1">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>工号</th>
        <th>部门</th>
        <th>操作</th>
    </tr>
    <%
        for (Users user : userList) {
    %>
    <tr>
        <td><%= user.getId() %></td>
        <td><%= user.getUsername() %></td>
        <td><%= user.getWorkCode() %></td>
        <td><%= user.getDepartment() %></td>
        <td>
            <form action="UserServlet" method="post" onsubmit="return confirm('确认删除？');">
                <input type="hidden" name="action" value="delete">
                <input type="hidden" name="id" value="<%= user.getId() %>">
                <input type="submit" value="删除">
            </form>
        </td>
    </tr>
    <%
        }
    %>
</table>
</body>
</html>
